import {
  IsString,
  IsEmail,
  IsOptional,
  IsNumber,
  IsBoolean,
  MinLength,
  MaxLength,
  IsDate,
} from 'class-validator';

/**
 * 用户 DTO（安全的用户信息，不包含密码）
 */
export class UserDto {
  @IsOptional()
  @IsNumber()
  id?: number;

  @IsString()
  @IsOptional()
  username?: string;

  @IsEmail()
  @IsOptional()
  email?: string;

  @IsOptional()
  @IsString()
  @MinLength(11, { message: '手机号长度必须为11位' })
  @MaxLength(11, { message: '手机号长度必须为11位' })
  phone?: string;

  @IsOptional()
  @IsBoolean()
  isActive?: boolean;

  @IsOptional()
  @IsDate()
  createdAt?: Date;

  @IsOptional()
  @IsDate()
  updatedAt?: Date;
}
